package org.terramagnet.workflow.dynamic.databinding;

/**
 * 字段.
 *
 * @param T 程序中使用的实际数据类型
 * @author terrason
 */
public class Field<T> {

    /**
     * 标签.
     */
    private String label;
    /**
     * 字段名称.
     */
    private String name;
    /**
     * 字段详细说明.
     */
    private String description;
    /**
     * 字段值.
     */
    private T value;
    /**
     * 字段类型.
     */
    private DataType<T> type;

    /**
     * 当前字段值是否为{@code null}.
     */
    public boolean isNull() {
        return value == null;
    }

    /**
     * 标签.
     *
     * @return the label
     */
    public String getLabel() {
        return label;
    }

    /**
     * 标签.
     *
     * @param label the label to set
     */
    public void setLabel(String label) {
        this.label = label;
    }

    /**
     * 字段名称.
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * 字段名称.
     *
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 字段值.
     *
     * @return the value
     */
    public T getValue() {
        return value;
    }

    /**
     * 字段值.
     *
     * @param value the value to set
     */
    public void setValue(T value) {
        this.value = value;
    }

    /**
     * 字段类型.
     *
     * @return the type
     */
    public DataType<T> getType() {
        return type;
    }

    /**
     * 字段类型.
     *
     * @param type the type to set
     */
    public void setType(DataType<T> type) {
        this.type = type;
    }

    /**
     * 字段详细说明.
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * 字段详细说明.
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }
}
